const app = getApp()
import { getAnnouncementDetail } from '../../../../api/index'

Page({
  data: {
    id: '',
    type: '',
    detail: {}
  },
  async getDetail () {
    try {
      const { ResultSet } = await getAnnouncementDetail({ messageId: this.data.id })
      this.setData({ detail: ResultSet.userData })
    } catch (err) {
      wx.showToast({ title: err.message || err.ResultSet.erros, icon: 'none' })
    }
  },
  onLoad ({ id, type }) {
    this.setData({ id: parseInt(id), type: parseInt(type) })
    this.getDetail()
  }
})